﻿using System.Linq;
using Calendar.Logic.Core;
using Calendar.Logic.ObjectModel.Authorization;

namespace Calendar.Logic.ObjectManager.Authorization
{
    internal static class RoleManagerExtended
    {
        public static IQueryable<Role> SelectByName(this IQueryable<Role> table, string name)
        {
            return table.SelectByApp().Where(r => r.Rolename == name);
        }

        public static IQueryable<Role> SelectByApp(this IQueryable<Role> table)
        {
            return table.Where(r => r.ApplicationName == GlobalContext.Instance.ApplicationName);
        }
    }

    public class RoleManager : BaseManager<RoleManager, Role>
    {
    }
}
